package come.pbms.nursing.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import come.pbms.nursing.domain.NursingServe;
import come.pbms.nursing.mapper.NursingMapper;
import come.pbms.nursing.service.NursingService;
import come.pbms.nursing.vo.NursingServePageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NursingServiceImpl implements NursingService {

    @Autowired
    private NursingMapper nursingMapper;
    @Override
    public NursingServePageVO getList(Integer pageNum, Integer pageSize, Integer status, String serviceName) {
        PageHelper.startPage(pageNum,pageSize);
        Page<NursingServe> page=nursingMapper.page(status, serviceName);

        return new NursingServePageVO(page.getTotal(),page.getResult(),pageNum,pageSize);
    }

    @Override
    public int insertNursingServe(NursingServe nursingServe) {
        return nursingMapper.insertNursingServe(nursingServe)?1:0;
    }

    @Override
    public NursingServe getById(Integer serviceId) {
        return nursingMapper.getById(serviceId);
    }

    @Override
    public int update(NursingServe nursingServe) {

        return nursingMapper.update(nursingServe)?1:0;
    }

    @Override
    public int deleteById(Integer serviceId) {
        return nursingMapper.deleteById(serviceId);
    }


}
